445A - DZY Loves Chessboard - CodeForces Solution


dfs and similar implementation *1200

Please click on ads to support us..

Python Code:

n , m = map(int, input().split())
chessBoard =[]
for i in range(n):
    chessBoard.append([y for y in input()])

for i in range(n):
    for j in range(m):
        if chessBoard[i][j] == "." :
            if((j+i)%2==0):
                chessBoard[i][j]='B';
            else:
                chessBoard[i][j]='W';
            
for x in chessBoard:
    for y in x:
        print(y,end = "")
    print()


Comments

Submit
0 Comments
More Questions

855A - Tom Riddle's Diary
1417A - Copy-paste
1038A - Equality
1061A - Coins
1676E - Eating Queries
1447A - Add Candies
1721D - Maximum AND
363C - Fixing Typos
1401A - Distance and Axis
658A - Bear and Reverse Radewoosh
1721E - Prefix Function Queries
977E - Cyclic Components
1140D - Minimum Triangulation
75C - Modified GCD
1722A - Spell Check
1722B - Colourblindness
1722D - Line
1722C - Word Game
1722G - Even-Odd XOR
552E - Vanya and Brackets
933A - A Twisty Movement
1722F - L-shapes
1196B - Odd Sum Segments
1325D - Ehab the Xorcist
552B - Vanya and Books
1722E - Counting Rectangles
168A - Wizards and Demonstration
168B - Wizards and Minimal Spell
7A - Kalevitch and Chess
912B - New Year's Eve